<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            <h2><a href="#" class="back" onclick="history.go(-1)"/>Pesquisar Sugestão</h2>
        </ui:define>

        <ui:define name="body">

            <h:form id="sugestaoForm" enctype="multipart/form-data">            
                <p:messages id="messages" closable="true" showDetail="false" autoUpdate="true"  />
                <p:panel id="sugestaoPanel" styleClass="container_24 clearfix" >
                    <h2>Sugestões</h2>
                    <p:dataTable id="sugestaoDataTable" var="item" value="#{managerPesquisarSugestao.sugestoes}" 
                                 styleClass="grid_24" rowIndexVar="rowid" 
                                 style="white-space: pre-wrap;"
                                 rowKey="#{item.id}" rows="5" paginator="true"  
                                 paginatorPosition="bottom" emptyMessage="Nenhum registro">  
                        <f:facet name="header">
                            <p:outputLabel value="Campus" />
                        </f:facet>
                        <p:column headerText="Ação" width="10px;" > 
                            <p:button title="Visualizar" 
                                      href="visualizarsugestao.xhtml?vSugestao=#{item.id}"
                                      icon="ui-icon-zoomin"/> 
                            <p:commandButton update="@form" title="Excluir"
                                             oncomplete="dlg.show()"
                                             icon="ui-icon-trash" >
                                <f:setPropertyActionListener target="#{managerPesquisarSugestao.sugestaoDelete}" value="#{item}" />
                            </p:commandButton>
                        </p:column>
                        <p:column headerText="Nome"> 
                            <p:outputLabel value="#{item.descricao}"/>
                        </p:column>

                    </p:dataTable>
                </p:panel>

                <div class="buttonAction">
                    <p:button value="Cancelar" icon="ui-icon-circle-close"
                              href="index.xhtml" />
                </div>
                
                 <p:dialog id="modalDialog" header="Confirmação de remoção" widgetVar="dlg" modal="true" 
                          height="80" closable="true" resizable="false" >
                    <h:outputText value="Tem certeza que deseja remover esta sugestão?" />
                    <div class="buttonAction">
                        <p:commandButton value="Sim"
                                         actionListener="#{managerPesquisarSugestao.deletar()}"
                                         update="@form"
                                         icon="ui-icon-check"/>
                        <p:commandButton value="Não" icon="ui-icon-circle-close"
                                         oncomplete="dlg.hide()" />

                    </div>
                </p:dialog>
            </h:form>

        </ui:define>
    </ui:composition>
</html>


